package com.axjy.web;


import com.axjy.pojo.Cys;
import com.axjy.service.CysService;
import java.util.List;

import com.axjy.util.Log;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/cys/cys")
public class CysHandler {

    @Resource
    private CysService cysService;



    @GetMapping("/list")
    public List<Cys> list(String mobile,String name,String address){
        return cysService.list(mobile,name,address);
    }

    @PostMapping("/add")
    public String add(Cys cys){
        String msg=null;
        try{
            cysService.add(cys);
            msg="新增承运商成功";
        }catch (RuntimeException ex){
            msg="新增承运商失败";
            Log.logger.error(msg,ex);
        }
        return msg;
    }

}
